<template>
  <op-dialog ref="dialogRef" height="100px" :title="title" @confirm="confirm" @cancel="cancel">
    <div class="content" :style="itemStyle">{{ content }}</div>
  </op-dialog>
</template>
<script setup>
const props = defineProps({
  title: {
    type: String,
    default: 'Confirm',
  },
  content: {
    type: String,
    default: 'Are you sure to Confirm ?',
  },
  itemStyle: {
    type: [String, Array],
  },
});
const emits = defineEmits(['confirm', 'cancel']);
const dialogRef = ref();
const init = row => {
  dialogRef.value.init(row);
};
const destroy = () => {
  dialogRef.value.destroy();
};
const confirm = row => {
  emits('confirm', row);
  destroy();
};

const cancel = () => {
  emits('cancel');
};
defineExpose({ init, destroy });
</script>
<style lang="scss" scoped>
.content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: bold;
  font-size: 18px;
}
</style>
